package org.zoomdev.zoom.dao.impl;

import org.zoomdev.zoom.dao.adapters.EntityField;
import org.zoomdev.zoom.dao.adapters.ResultSetAdapter;
import org.zoomdev.zoom.dao.adapters.StatementAdapter;
import org.zoomdev.zoom.dao.struct.ColumnMeta;

import java.lang.reflect.Type;
import java.util.Map;

public class RecordEntityField extends EntityField {

    public RecordEntityField(ColumnMeta columnMeta, String fieldName, Type fieldType, StatementAdapter statementAdapter, ResultSetAdapter resultSetAdapter) {
        super(columnMeta, fieldName, fieldType, statementAdapter, resultSetAdapter);
    }


    @Override
    public Object get(Object target) {
        return ((Map<String, Object>) target).get(getFieldName());
    }

    @Override
    public void set(Object target, Object value) {

        ((Map<String, Object>) target).put(getFieldName(), value);
    }
}
